#include "imagewidget.h"

#include <QtGui/QPainter>

#include "qtopencv.h"
#include "process.h"

ImageWidget::ImageWidget(QWidget* parent /* = 0 */)
	:QWidget(parent)
{
	setFixedSize(960, 540);
	//process_ = new Process();

}

ImageWidget::~ImageWidget()
{

}

void ImageWidget::paintEvent(QPaintEvent *event)
{
	QWidget::paintEvent(event);
	if (!Process::getSingleton().get_image())
	{
		return;
	}
	QImage* image = IplImage2QImage(Process::getSingleton().get_image());
	QImage img = image->scaled(image->width() / 2, image->height() / 2);
	QPainter p(this);
	p.drawImage(0, 0, img);
	delete image;

}